From 61422709670ce10ab9c700929d3a29ff37f49df1 Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 14 May 2008 15:54:55 +0000 Subject: [PATCH] Move m241 to its own type instead of a barnacle on mtk. --- configure | 4 +-- configure.in | 4 +-- gbversion.h | 4 +-- mtk_logger.c | 67 ++++++++++++++++++++++++++++--------- testo | 2 +- vecs.c | 14 ++++++++ xmldoc/formats/m241-bin.xml | 12 +++++++ xmldoc/formats/m241.xml | 12 +++++++ 8 files changed, 97 insertions(+), 22 deletions(-) create mode 100644 xmldoc/formats/m241-bin.xml create mode 100644 xmldoc/formats/m241.xml diff --git a/configure b/configure index ba89b6b49..4e3ea62e6 100755 --- a/configure +++ b/configure @@ -1746,7 +1746,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Increase GBBUILD for a new release GBBUILD=16 # YYYYMMDD, please, if beta, i.e. "-beta20060413" -# PACKAGE_RELEASE="-beta20080305" +PACKAGE_RELEASE="-beta20080514" cat >>confdefs.h <<_ACEOF #define PACKAGE_RELEASE "$PACKAGE_RELEASE" @@ -1756,7 +1756,7 @@ _ACEOF DOCVERSION=`echo $PACKAGE_VERSION` DOCVERSION=development -DOCVERSION=1.3.5 +# DOCVERSION=1.3.5 GBMAJOR=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $major)` diff --git a/configure.in b/configure.in index 15982033c..50701149c 100644 --- a/configure.in +++ b/configure.in @@ -7,13 +7,13 @@ AC_INIT(GPSBabel, 1.3.5, BUG-REPORT-ADDRESS) # Increase GBBUILD for a new release GBBUILD=16 # YYYYMMDD, please, if beta, i.e. "-beta20060413" -# PACKAGE_RELEASE="-beta20080305" +PACKAGE_RELEASE="-beta20080514" AC_DEFINE_UNQUOTED(PACKAGE_RELEASE, "$PACKAGE_RELEASE", [Define to the release name of this package.]) AC_SUBST(PACKAGE_RELEASE) DOCVERSION=`echo $PACKAGE_VERSION` DOCVERSION=development -DOCVERSION=1.3.5 +# DOCVERSION=1.3.5 AC_SUBST(DOCVERSION) GBMAJOR=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $major)` diff --git a/gbversion.h b/gbversion.h index 070161cad..5ab54b9f5 100644 --- a/gbversion.h +++ b/gbversion.h @@ -4,5 +4,5 @@ * * Isn't simplification via automation grand? */ -#define VERSION "1.3.5" -#define WEB_DOC_DIR "http://www.gpsbabel.org/htmldoc-1.3.5" +#define VERSION "1.3.5-beta20080514" +#define WEB_DOC_DIR "http://www.gpsbabel.org/htmldoc-development" diff --git a/mtk_logger.c b/mtk_logger.c index 799a58cf9..39428e71d 100644 --- a/mtk_logger.c +++ b/mtk_logger.c @@ -190,8 +190,7 @@ static FILE *fl; /* bin.file fd */ static char *port; /* serial port name */ static char *erase; /* erase ? command option */ static char *csv_file; /* csv ? command option */ -static char *m241; /* m241 ? command option */ -#define IS_M241 (m241 && (*m241 != '0')) +static int is_m241=0; static unsigned int bmask = 0x000e0e7f; static unsigned int mlog_period, mlog_distance, mlog_speed; /* in 10:ths of sec, m, km/h */ @@ -207,12 +206,12 @@ const char CMD_LOG_FORMAT[] = "$PMTK182,2,2*39\r\n"; const char CMD_LOG_ERASE[] = "$PMTK182,6,1*3E\r\n"; +static void mtk_rd_init(const char *fname); static void file_init(const char *fname); static void file_deinit(void) ; static void file_read(void); - // Arguments for logg fetch 'mtk' command.. static arglist_t mtk_sargs[] = { @@ -220,8 +219,6 @@ static arglist_t mtk_sargs[] = { "0", ARGTYPE_BOOL, ARG_NOMINMAX }, { "csv", &csv_file, "MTK compatible CSV output file", NULL, ARGTYPE_STRING, ARG_NOMINMAX }, - { "m241", &m241, "Special support for HOLUX M-241 Logger", - "0", ARGTYPE_BOOL, ARG_NOMINMAX }, ARG_TERMINATOR }; @@ -331,6 +328,10 @@ static int do_cmd(const char *cmd, const char *expect, time_t timeout_sec) { /******************************************************************************* * %%% global callbacks called by gpsbabel main process %%% * *******************************************************************************/ +static void mtk_rd_init_m241 (const char *fname) { + is_m241 = 1; + mtk_rd_init(fname); +} static void mtk_rd_init(const char *fname){ int rc; @@ -345,7 +346,7 @@ static void mtk_rd_init(const char *fname){ // verify that we have a MTK based logger... dbg(1, "Verifying MTK based device...\n"); - if ( IS_M241 ) { + if ( is_m241 ) { log_type[LATITUDE].size = log_type[LONGITUDE].size = 4; log_type[HEIGHT].size = 3; rc = gbser_set_port(fd, MTK_BAUDRATE_M241, 8, 0, 1); @@ -791,7 +792,7 @@ int mtk_parse(unsigned char *data, int dataLen, unsigned int bmask){ } break; case 1< 0 ) { int j; printf("Missing '*' !\n"); @@ -915,7 +916,7 @@ int mtk_parse(unsigned char *data, int dataLen, unsigned int bmask){ return 16; } } - if ( ! IS_M241 ) i++; // skip '*' separator + if ( ! is_m241 ) i++; // skip '*' separator if ( data[i] != crc ){ printf("%2d: Bad CRC %.2x != %.2x\n", count, data[i], crc); @@ -949,7 +950,7 @@ static int mtk_parse_info(const unsigned char *data, int dataLen){ case 0x02: bm = le_read32(data + 8); dbg(1, "# Log bitmask is: %.8x\n", bm); - if ( IS_M241 ) + if ( is_m241 ) bm &= 0x7fffffffU; if ( bmask != bm ) dbg(1," ########## Bitmask Change %.8x -> %.8x ###########\n", bmask, bm); @@ -997,12 +998,17 @@ static int mtk_parse_info(const unsigned char *data, int dataLen){ /********************** File-in interface ********************************/ +static void file_init_m241(const char *fname) { + is_m241=1; + file_init(fname); +} + static void file_init(const char *fname) { dbg(4, "Opening file %s...\n", fname); if (fl = fopen(fname, "rb"), NULL == fl) { fatal(MYNAME ": Can't open file '%s'\n", fname); } - if ( IS_M241 ) { + if ( is_m241 ) { log_type[LATITUDE].size = log_type[LONGITUDE].size = 4; log_type[HEIGHT].size = 3; } @@ -1014,7 +1020,7 @@ static void file_deinit(void) { } static int is_holux_string(const unsigned char *data, int dataLen) { - if ( IS_M241 && + if ( is_m241 && dataLen >= 5 && data[0] == (0xff & 'H') && data[1] == (0xff & 'O') && @@ -1062,7 +1068,7 @@ static void file_read(void) { unsigned int mask, log_period, log_distance, log_speed; mask = le_read32(buf + 2); - if ( IS_M241 ) { + if ( is_m241 ) { // clear Holux-specific 'low precision' bit mask &= 0x7fffffffU; } @@ -1182,13 +1188,30 @@ ff_vecs_t mtk_vecs = { /* not fixed, can be changed through command line parameter */ }; +ff_vecs_t mtk_m241_vecs = { + ff_type_serial, + { + ff_cap_none /* waypoints */, + ff_cap_read /* tracks */, + ff_cap_none /* routes */ + }, + mtk_rd_init_m241, + NULL, + mtk_rd_deinit, + NULL, + mtk_read, + NULL, + NULL, + mtk_sargs, + CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ + /* not fixed, can be changed through command line parameter */ +}; + /* used for mtk-bin */ static arglist_t mtk_fargs[] = { { "csv", &csv_file, "MTK compatible CSV output file", NULL, ARGTYPE_STRING, ARG_NOMINMAX }, - { "m241", &m241, "Special support for HOLUX M-241 Logger", - "0", ARGTYPE_BOOL, ARG_NOMINMAX }, ARG_TERMINATOR }; @@ -1205,5 +1228,19 @@ ff_vecs_t mtk_fvecs = { mtk_fargs, CET_CHARSET_UTF8, 1 /* master process: don't convert anything | CET-REVIEW */ }; + +ff_vecs_t mtk_m241_fvecs = { + ff_type_file, + { ff_cap_none, ff_cap_read, ff_cap_none }, + file_init_m241, + NULL, + file_deinit, + NULL, + file_read, + NULL, + NULL, + mtk_fargs, + CET_CHARSET_UTF8, 1 /* master process: don't convert anything | CET-REVIEW */ +}; /* End file: mtk_logger.c */ /**************************************************************************/ diff --git a/testo b/testo index 2b5c06e9d..77768d349 100755 --- a/testo +++ b/testo @@ -1301,7 +1301,7 @@ compare ${TMPDIR}/mtk_logger.csv ${REFERENCE}/track/mtk_logger.csv # MTK logger tests (Holux M-241) # rm -f ${TMPDIR}/mtk_logger_m241.* -${PNAME} -t -w -i mtk-bin,m241,csv=${TMPDIR}/mtk_logger_m241.csv -f ${REFERENCE}/track/mtk_logger_m241.bin -o gpx -F ${TMPDIR}/mtk_logger_m241.gpx +${PNAME} -t -w -i m241-bin,csv=${TMPDIR}/mtk_logger_m241.csv -f ${REFERENCE}/track/mtk_logger_m241.bin -o gpx -F ${TMPDIR}/mtk_logger_m241.gpx compare ${TMPDIR}/mtk_logger_m241.gpx ${REFERENCE}/track/mtk_logger_m241.gpx ## CSV compare needs to be done with '-w' - ignore whitespace. compare ${TMPDIR}/mtk_logger_m241.csv ${REFERENCE}/track/mtk_logger_m241.csv diff --git a/vecs.c b/vecs.c index c091ae435..86b8bd969 100644 --- a/vecs.c +++ b/vecs.c @@ -81,6 +81,8 @@ extern ff_vecs_t mps_vecs; extern ff_vecs_t msroute_vecs; extern ff_vecs_t mtk_vecs; extern ff_vecs_t mtk_fvecs; +extern ff_vecs_t mtk_m241_vecs; +extern ff_vecs_t mtk_m241_fvecs; extern ff_vecs_t navicache_vecs; extern ff_vecs_t netstumbler_vecs; extern ff_vecs_t nmea_vecs; @@ -432,6 +434,18 @@ vecs_t vec_list[] = { "MTK Logger (iBlue 747,...) Binary File Format", "bin" }, + { + &mtk_m241_vecs, + "m241", + "Holux M-241 (MTK based) download", + NULL + }, + { + &mtk_m241_fvecs, + "m241-bin", + "Holux M-241 (MTK based) Binary File Format", + "bin" + }, { &wbt_svecs, "wbt", diff --git a/xmldoc/formats/m241-bin.xml b/xmldoc/formats/m241-bin.xml new file mode 100644 index 000000000..d56097b26 --- /dev/null +++ b/xmldoc/formats/m241-bin.xml @@ -0,0 +1,12 @@ + + The Holux m241 is a small datalogger using the MTK chipset, with + a couple small differences in the binary format. In its default + configuration, it can store ~100000 trackpoints with very limited + data; to configure extended logging you can use the BT747 open + source software + bt747 + Waypoint storage is possible only if RCR is enabled in the settings. + + + Use the m241 format to connect with the unit serially and m241-bin to read files saved by the device. + diff --git a/xmldoc/formats/m241.xml b/xmldoc/formats/m241.xml new file mode 100644 index 000000000..d56097b26 --- /dev/null +++ b/xmldoc/formats/m241.xml @@ -0,0 +1,12 @@ + + The Holux m241 is a small datalogger using the MTK chipset, with + a couple small differences in the binary format. In its default + configuration, it can store ~100000 trackpoints with very limited + data; to configure extended logging you can use the BT747 open + source software + bt747 + Waypoint storage is possible only if RCR is enabled in the settings. + + + Use the m241 format to connect with the unit serially and m241-bin to read files saved by the device. + -- 2.30.2